<?php $replay = $sf_data->getRaw('replay') ?>

<h1><?php echo __('Replay részletek') ?></h1>
<div style="width:750px;">
    <div style="float:left;">
        <h3><?php echo __('Általános információk') ?></h3>
        <?php $gameInfo = $replay->getGameInfo() ?>
        <table class="stdtable replay_info">
            <tr>
                <th><?php echo __('Pálya neve') ?></th>
                <th><?php echo __('Meccs hossza') ?></th>
                <th><?php echo __('Sebesség') ?></th>
                <th rowspan="2"><a href="<?php echo $replay->getDownloadLink() ?>"><?php echo __('Replay letöltés') ?></a></th>
            </tr>
            <tr>
                <td><?php echo $gameInfo['map_name'] ?></td>
                <td><?php echo ReplayPeer::getFormattedGameLength($gameInfo['game_length']) ?></td>
                <td><?php echo $gameInfo['game_speed'] ?></td>
            </tr>
        </table>

        <?php echo __('Megjegyzés:') ?>
        <p><?php echo $replay->getDescription() ?></p>

    </div>
    <div style="float:right;">
        <h3><?php echo __('Játékos adatok') ?></h3>
        <table class="stdtable replay_details">
            <tr>
                <th><?php echo __('Játékosnév') ?></th>
                <th><?php echo __('Faj') ?></th>
                <th><?php echo __('Átlag APM') ?></th>
                <th><?php echo __('Eredmény') ?></th>
            </tr>
            <?php foreach ($replay->getPlayers() as $player) : ?>
            <tr>
                <td><?php echo $player['name'] ?></td>
                <td><?php echo $player['race'] ?> <img src="<?php echo RacePeer::getSmallImageUrlByName($player['race']) ?>"/></td>
                <td class="centered"><?php echo $player['avg_apm'] ?></td>
                <td class="<?php echo ($replay->isWinner($player['name']))?"bg_winner":"bg_loser"; ?>">
                    <?php if ($replay->isWinner($player['name'])) : ?>
                        <?php echo __('Győztes') ?>
                    <?php else : ?>
                        <?php echo __('Vesztes') ?>
                    <?php endif; ?>
                </td>
            </tr>
            <?php endforeach; ?>
        </table>
    </div>
</div>
<div style="clear:both;"></div>

<h3><?php echo __('Üzenet napló') ?></h3>
<?php $messages = json_decode($replay->getMessageLog(), true) ?>

<table class="stdtable replay_messages">
    <tr>
        <th><?php echo __('Idő')?></th>
        <th><?php echo __('Játékosnév') ?></th>
        <th><?php echo __('Cél') ?></th>
        <th><?php echo __('Üzenet') ?></th>
    </tr>
    <?php foreach($messages as $message) : ?>
    <tr>
        <td><?php echo $message['time'] ?></td>
        <td><?php echo $message['name'] ?></td>
        <td><?php echo $message['target'] ?></td>
        <td><?php echo $message['message'] ?></td>
    </tr>
    <?php endforeach; ?>
</table>